﻿
namespace Patterns4Net.ArchitectureExplorer.ViewModels.Graph
{
    using Caliburn.Micro;
    using Graphviz4Net.Graphs;
    using Patterns4Net.ArchitectureExplorer.Diagram;
    using Patterns4Net.ArchitectureExplorer.ViewModels.Messages;

    public class SubGraphViewModel : SubGraph<VertexViewModel>
    {
        private readonly IEventAggregator eventAggregator;

        public SubGraphViewModel(DiagramElement diagramElement, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.Label = diagramElement.Name;
            this.DiagramElement = diagramElement;
        }

        protected DiagramElement DiagramElement { get; private set; }

        public void Select()
        {
            this.eventAggregator.Publish(new SelectDiagramElementMessage(this.DiagramElement));
        }

        public void ZoomIn()
        {
            this.eventAggregator.Publish(new ZoomToDiagramElementMessage(this.DiagramElement));
        }
    }
}
